//HJ86 求最大连续bit数


#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int n = 0;
    cin >> n;
    int tmp = 0, count = 0;
    while(n)
    {
        if(n&1)
        {
            tmp++;
        }
        else
        {
            count = max(count, tmp);
            tmp = 0;
        }
        n /= 2;
    }
    count = max(count, tmp);
    cout << count << endl;

    return 0;
}